package main

import (
	"fmt"
	"net"
)

func main() {
	conn,err:=net.Dial("tcp","127.0.0.1:8000")
	if err!=nil{
		fmt.Println("dial err",err)
		return
	}
	defer conn.Close()

	n,err:=conn.Write([]byte("hehe"))
	if err!=nil{
		fmt.Println("write err",err)
		return
	}
	fmt.Println(n)

	buf:=make([]byte,4096)
	n,err = conn.Read(buf)
	if err!=nil{
		fmt.Println("read error",err)
		return
	}
	fmt.Println("服务器回发数据：",string(buf[:n]))

}
